function [cam, ref, imageName, flow2DGt, flow2DGt_noc] = ...
  loadKittiFlow(strFolder, nr, p)

% loading the gt or some other stuff - no need for that only for painting

testing   = p.testing;
ImgL      = cell(1,2*p.frames+2);
ImgR      = cell(1,2*p.frames+2);

strNumber0 = sprintf( '%06d_%02d', nr, p.subImg );
strNumber1 = sprintf( '%06d_%02d', nr, p.subImg+1 );
imageName  = sprintf('Kitti_%s', strNumber0);

if ~testing
  localFolder = sprintf('%s/%s',strFolder, 'scene_flow_2015/training');
  kittipath= sprintf('%s%s%s', strFolder,num2str(p.kitti),'/training');
else
  localFolder = sprintf('%s/',strFolder, 'data_stereo_flow/testing');
  kittipath= sprintf('%s%s%s', strFolder,num2str(p.kitti),'testing')
end

if p.kitti==2012
% load from /home/chu/scene_flow/sceneflow_2012
  ImgL{1} = double(imread(sprintf('%s/%s/%s.png', kittipath, '/image_0', strNumber0 )))/255;
  ImgR{1} = double(imread(sprintf('%s/%s/%s.png', kittipath, '/image_1', strNumber0 )))/255;
  ImgL{2} = double(imread(sprintf('%s/%s/%s.png', kittipath, '/image_0', strNumber1 )))/255;
  ImgR{2} = double(imread(sprintf('%s/%s/%s.png', kittipath, '/image_1', strNumber1 )))/255;
  calibFile = sprintf('%s/%s/%06d.txt', kittipath, '/calib', nr );
else
% load from /home/chu/scene_flow/sceneflow_2015
  ImgL{1} = double(imread(sprintf('%s/%s/%s.png', kittipath, 'image_0', strNumber0 )))/255;
  ImgR{1} = double(imread(sprintf('%s/%s/%s.png', kittipath, 'image_1', strNumber0 )))/255;
  ImgL{2} = double(imread(sprintf('%s/%s/%s.png', kittipath, 'image_0', strNumber1 )))/255;
  ImgR{2} = double(imread(sprintf('%s/%s/%s.png', kittipath, 'image_1', strNumber1 )))/255;
  calibFile = sprintf('%s/%s/%06d.txt', kittipath, '/calib/calib_cam_to_cam', nr );
end

  data_supp = loadCalibrationKITTI_new( calibFile, p.kitti );
  data_supp.I = ImgR;

gt_Name = sprintf('%06d_10', nr);

if testing
    DispImg = ones(size(ImgL{1}));
    flowImg = repmat(DispImg, [1,1,3]);

else
    if p.kitti==2012
        stereoFolder = sprintf('%s/disp_noc', kittipath);
    else
        stereoFolder = sprintf('%s/disp_noc_0', kittipath);
    end
    flowFolder   = sprintf('%s/flow_noc', kittipath);
    DispImg = disp_read (sprintf('%s/%s.png',stereoFolder,gt_Name));
    flowImg = flow_read (sprintf('%s/%s.png',flowFolder,gt_Name));
end
flow2DGt_noc = cat (3, DispImg, flowImg);

if testing

else
    if p.kitti==2012
        stereoFolder = sprintf('%s/disp_occ', kittipath);
    else
        stereoFolder = sprintf('%s/disp_occ_0', kittipath);
    end
    flowFolder   = sprintf('%s/flow_occ', kittipath );
    DispImg = disp_read (sprintf('%s/%s.png',stereoFolder,gt_Name));
    flowImg = flow_read (sprintf('%s/%s.png',flowFolder,gt_Name));
end

flow2DGt     = cat (3, DispImg, flowImg);


[cam, ref] = generateStructures ( data_supp, ImgL, data_supp.R );
a=1;
